import xadmin

from apps.organizations.models import *


# 城市表
class CityAdmin(object):
    # 显示字段
    list_display = ['name', 'desc']
    # 用于搜索的字段
    search_fields = ['name', 'desc']
    # 用于筛选的字段
    list_filter = ['name', 'desc', 'add_time']
    # 可直接编辑的字段
    list_editable = ['name', 'desc']
    # 侧边栏图标
    model_icon = 'fa fa-building-o'


# 课程机构表
class CourseOrgAdmin(object):
    # 显示字段
    list_display = ['name', 'desc', 'click_nums', 'fav_nums']
    # 用于搜索的字段
    search_fields = ['name', 'desc', 'click_nums', 'fav_nums']
    # 用于筛选的字段
    list_filter = ['name', 'desc', 'click_nums', 'fav_nums']
    # 可直接编辑的字段
    list_editable = ['name', 'desc']
    # 侧边栏图标
    model_icon = 'fa fa-coffee'


# 教师表
class TeacherAdmin(object):
    # 显示字段
    list_display = ['name', 'org', 'work_years', 'click_nums', 'fav_nums']
    # 用于搜索的字段
    search_fields = ['name', 'work_company', 'work_years', 'click_nums', 'fav_nums']
    # 用于筛选的字段
    list_filter = ['name', 'work_company', 'work_years', 'click_nums', 'fav_nums']
    # 可直接编辑的字段
    list_editable = ['name', 'work_company', 'work_years', ]
    # 侧边栏图标
    model_icon = 'fa fa-address-card-o'


# 将数据表注册到管理界面
xadmin.site.register(City, CityAdmin)
xadmin.site.register(CourseOrg, CourseOrgAdmin)
xadmin.site.register(Teacher, TeacherAdmin)
